import pymysql.constants.ER
n=input()

s=0
list1=[]
for i in range(2,n):
    for j in range(2,i-1):
        if int(i)%j==0:
            break
    else:
        list1.append(i)
        s+=i

print(list1)
print(s)
